package com.prwan.msnotify.listener;

import com.prwan.msnotify.client.EquipmentStatusClient;
import com.prwan.msnotify.pojo.EquipmentStatus;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Auther: zhy
 * @Date: 2019/7/21
 * @Description: 设备状态监听器
 */
@Component
@RabbitListener(queues = "equipmentstatus")
public class EquipmentStatusListener {

    @Autowired
    private EquipmentStatusClient equipmentStatusClient;

    @RabbitHandler
    public void handlerMs(String ms) {
        //更新设备状态
        System.out.println(ms);
        /*String[] ids = ms.split(",");*/
        EquipmentStatus equipmentStatus = new EquipmentStatus();
        equipmentStatus.setRunningState("0");
        equipmentStatusClient.update(equipmentStatus,"d90fa3b94b684c88aac561ce333f1bb9");
    }

}
